package com.futureweaver.controller;

import com.futureweaver.domain.Prescription;
import com.futureweaver.domain.Register;
import com.futureweaver.service.PrescriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/prescription")
public class PrescriptionController {
    @Autowired
    private PrescriptionService service;

    @RequestMapping("/insert")
    @ResponseBody
    public boolean insert(@RequestBody Prescription prescription) {
        return service.insert(prescription);
    }

    @RequestMapping("/query")
    @ResponseBody
    public List<Prescription> query(@RequestBody Register register) {
        return service.query(register);
    }

    @RequestMapping("/update")
    @ResponseBody
    public boolean update(@RequestBody Prescription prescription) {
        return service.update(prescription);
    }
}
